﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Collections;

namespace employee.Controls
{
    public partial class emWorkRewardDetail : common.controls.baseUserControl
    {
        public string myRewardCat = CommonTypes.Consts.constWorkReward;
        public emWorkRewardDetail()
        {
            InitializeComponent();
        }

        public void SetDataSource(BindingSource dataSrc)
        {

            data.baseDS.emWorkRewardDataTable tbl = (data.baseDS.emWorkRewardDataTable)dataSrc.DataSource;
            common.BindingLibs.BindObject(this.titleEd, dataSrc,DataAccess.DataCache.myBaseDS.emWorkReward.tittleColumn.ColumnName);
            common.BindingLibs.BindObject(this.typeCb, dataSrc, DataAccess.DataCache.myBaseDS.emWorkReward.typeColumn.ColumnName);
            common.BindingLibs.BindObject(this.issuerEd, dataSrc, DataAccess.DataCache.myBaseDS.emWorkReward.issueByColumn.ColumnName);
            common.BindingLibs.BindObject(this.decisionNoEd, dataSrc, DataAccess.DataCache.myBaseDS.emWorkReward.decisionNoColumn.ColumnName);
            common.BindingLibs.BindObject(this.onDateEd, dataSrc, DataAccess.DataCache.myBaseDS.emWorkReward.onDateColumn.ColumnName);
            common.BindingLibs.BindObject(this.descEd, dataSrc, DataAccess.DataCache.myBaseDS.emWorkReward.descriptionColumn.ColumnName);

            this.titleEd.MaxLength = DataAccess.DataCache.myBaseDS.emWorkReward.tittleColumn.MaxLength;
            this.decisionNoEd.MaxLength = DataAccess.DataCache.myBaseDS.emWorkReward.decisionNoColumn.MaxLength;
            this.issuerEd.MaxLength = DataAccess.DataCache.myBaseDS.emWorkReward.issueByColumn.MaxLength;
            this.descEd.MaxLength = DataAccess.DataCache.myBaseDS.emWorkReward.descriptionColumn.MaxLength;
        }
        public virtual void Init() 
        {
            typeCb.LoadData();
        }

        public virtual bool CheckData()
        {
            bool retVal = true;
            ClearNotifyError();
            //if (titleEd.Text.Trim() == "")
            //{
            //    NotifyError(titleLbl);
            //    retVal = false;
            //}
            //if (issuerEd.Text.Trim() == "")
            //{
            //    NotifyError(issuerLbl);
            //    retVal = false;
            //}
            //if (typeCb.myValue == "")
            //{
            //    NotifyError(typeLbl);
            //    retVal = false;
            //}
            return retVal;
        }
        public virtual void LockEdit(bool state)
        {
            state = !state;
            titleEd.Enabled = state;
            onDateEd.Enabled = state;
            typeCb.Enabled = state;
            decisionNoEd.Enabled = state;
            issuerEd.Enabled = state;
            descEd.Enabled = state;
        }
        public virtual void SetFocus()
        {
            this.Focus();
            titleEd.Focus();
        }
    }
}
